Skip to content

fix(tui): support middle-click paste from X11 primary selection#16379

Open
linuxhd0 wants to merge 1 commit intoanomalyco:devfrom
linuxhd0:fix/middle-click-paste
Open

fix(tui): support middle-click paste from X11 primary selection#16379
linuxhd0 wants to merge 1 commit intoanomalyco:devfrom
linuxhd0:fix/middle-click-paste

Conversation

@linuxhd0
Copy link

@linuxhd0 linuxhd0 commented Mar 6, 2026

Issue for this PR

Closes #8915

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

It allows someone on Linux (Xorg, Wayland) to select text in one application and use the middle mouse button to paste into the prompt textbox without have to do ctrl-c + ctrl-v. This is common behaviour on Linux systems.

How did you verify your code works?

I ran bun dev after making the changes, selected some text in another terminal and pasted it into opencode and it worked. Without the fix, you don't get anything indication that anything at all happened in opencode.

I use Xorg, didn't try Wayland though.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

  1. PR fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370: "fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste"

  2. PR feat(opencode): add linux clipboard toast warnings  #10332: "feat(opencode): add linux clipboard toast warnings"

These PRs appear to be addressing the same or very similar issue regarding middle-click paste support on Linux systems.

@linuxhd0
Copy link
Author

linuxhd0 commented Mar 7, 2026

All three open PRs touch Linux clipboard/middle-click paste but they're not really duplicates — each addresses a diiferent issue with pasting.

Summary Table

PR Title Problem Approach Files
#16379 fix(tui): support middle-click paste from X11 primary selection Middle-clicking into opencode's prompt does nothing On MouseButton.MIDDLE, call new Clipboard.readPrimary() and insert text clipboard.ts, prompt/index.tsx
#6370 fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste Text copied from opencode doesn't populate the primary selection, so other apps can't middle-click paste it On copy, optionally also write to the primary clipboard via --primary flag; opt-in via clipboard.linux.enablePrimaryCopy config clipboard.ts, config.ts
#10332 feat(opencode): add linux clipboard toast warnings Clipboard operations silently fail when wl-copy/xclip/xsel are not installed Return a CopyResult with a notice/warning and show toasts in the TUI clipboard.ts, multiple TUI call sites

Why They Are Complementary

As of today, all three can be merged independently and without conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On konsole, middle button press does not paste

1 participant